<!-- 商品详情的立即购买的提交订单里的支付页面。可以复用 -->
<template>
	<view class="page">
		<view class="price-count-down">
			<view class="price">
				<text class="min">￥{{money}}</text>
			</view>
			<view class="count-down">
				<view class="title">支付剩余时间</view>
				<view class="count">
					<text class="time">{{hour}}</text>
					<text class="dot">:</text>
					<text class="time">{{min}}</text>
					<text class="dot">:</text>
					<text class="time">{{sec}}</text>
				</view>
			</view>
		</view>
		<!-- 支付方式列表 -->
		<view class="pay-way">
			<view class="pay-list">
				<view class="list">
					<view class="pay-type">
						<image :src="PayList.icon" mode=""></image>
						<text>{{PayList.name}}</text>
					</view>
					<view class="check">
						<text class="iconfont" :class="PayWay === index ? 'icon-checked action':'icon-check'"></text>
					</view>
				</view>
			</view>
		</view>
		<view class="pay-submit">
			<view class="submit" @click="onSubmit">支付宝支付￥{{money}}</view>
		</view>
	</view>
</template>

<script>
	import {
		baseUrl
	} from '@/config/baseUrl.js';
	export default {
		data() {
			return {
				timer:null,
				PayList: {
					icon: '/static/zfb_pay.png',
					name: '支付宝支付',
				},
				CountDown: 900,
				day: 0,
				hour: 0,
				min: 0,
				sec: 0,
				orderNo:'',
				money:'',
				
			};
		},
		onLoad(params) {
			this.orderNo = params.orderNo;
			this.money = params.money;
			this.CountDownData();
		},
		methods: {
			/**
			 * 倒计时
			 */
			CountDownData() {
				this.timer = setInterval(() => {
					this.CountDown--;
					this.day = parseInt(this.CountDown / (24 * 60 * 60))
					this.hour = parseInt(this.CountDown / (60 * 60) % 24);
					this.min = parseInt(this.CountDown / 60 % 60);
					this.sec = parseInt(this.CountDown % 60);
					if(this.CountDown == 0){
						clearTimeout(this.timer);
						wx.switchTab({
							url:'/pages/my/my',
						})
					}
					// uni.setStorageSync(this.orderNo,this.CountDown);
					// console.log(uni.getStorageSync(this.orderNo));
				}, 1000)
			},
			/**
			 * 支付点击
			 */
			onSubmit() {
				uni.redirectTo({
					url: '/pages/test/h5?orderNo='+this.orderNo+'&money='+this.money
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	@import 'CashierDesk.scss';
</style>
